<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setCharacterEncoding("UTF-8");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'emp_add.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css" href="css/emp_add.css">

</head>
<body>
	<c:choose>
		<c:when test="${param.dept_name!=null}">
			<sql:update var="result1">
			insert into t_department (dept_name,dept_depict,dept_director,dept_staff_num,dept_setup_time) value (?,?,?,0,now())
			  <sql:param value="${param.dept_name}" />
				<sql:param value="${param.dept_depict}" />
				<sql:param value="${param.dept_director}" />
			</sql:update>
			<h1>添加成功</h1>
		</c:when>
		<c:otherwise>
			<h3>添加部门</h3>
			<div id="container">
				<form id="fm-form" method="post" action="admin/dept_add.jsp">
					<fieldset>
						<div class="fm-opt">
							<label for="fm-addr">部门名称</label> <input id="fm-addr"
								name="dept_name" type="text">
						</div>
						<div class="fm-opt">
							<label for="fm-addr">部门描述</label> <input id="fm-addr"
								name="dept_depict" type="text">
						</div>
						<div class="fm-opt">
							<label for="fm-addr">负责人</label> <input id="fm-addr"
								name="dept_director" type="text">
						</div>
					</fieldset>

					<div id="fm-submit" class="fm-req">
						<input name="Submit" value="&#25552; &#20132;" type="submit">
					</div>
					<br>
				</form>
			</div>
		</c:otherwise>
	</c:choose>
</body>
</html>
